home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb.new / gdb-4.0 / bfd / doc / targets.p < prev    next >
Encoding:
Text File  |  1991-09-29  |  8.1 KB  |  276 lines

  1. /* bfd_target
  2. @node bfd_target
  3. @subsection bfd_target
  4. This structure contains everything that BFD knows about a target.
  5. It includes things like its byte order, name, what routines to call
  6. to do various operations, etc.   
  7.  
  8. Every BFD points to a target structure with its "xvec" member. 
  9.  
  10. Shortcut for declaring fields which are prototyped function pointers,
  11. while avoiding anguish on compilers that don't support protos.
  12. */
  13.  
  14. #define SDEF(ret, name, arglist) \
  15.                 PROTO(ret,(*name),arglist)
  16. #define SDEF_FMT(ret, name, arglist) \
  17.                 PROTO(ret,(*name[bfd_type_end]),arglist)
  18.  
  19. /*
  20. These macros are used to dispatch to functions through the bfd_target
  21. vector. They are used in a number of macros further down in @file{bfd.h}, and
  22. are also used when calling various routines by hand inside the BFD
  23. implementation.  The "arglist" argument must be parenthesized; it
  24. contains all the arguments to the called function.
  25. */
  26.  
  27. #define BFD_SEND(bfd, message, arglist) \
  28.                ((*((bfd)->xvec->message)) arglist)
  29.  
  30. /*
  31. For operations which index on the BFD format 
  32. */
  33.  
  34. #define BFD_SEND_FMT(bfd, message, arglist) \
  35.             (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
  36.  
  37. /*
  38. This is the struct which defines the type of BFD this is.  The
  39. "xvec" member of the struct @code{bfd} itself points here.  Each module
  40. that implements access to a different target under BFD, defines
  41. one of these.
  42.  
  43. FIXME, these names should be rationalised with the names of the
  44. entry points which call them. Too bad we can't have one macro to
  45. define them both! 
  46. */
  47.  
  48. typedef struct bfd_target
  49. {
  50.  
  51. /*
  52. identifies the kind of target, eg SunOS4, Ultrix, etc 
  53. */
  54.  
  55.   char *name;
  56.  
  57. /*
  58. The "flavour" of a back end is a general indication about the contents
  59. of a file.
  60. */
  61.  
  62.   enum target_flavour_enum {
  63.     bfd_target_aout_flavour_enum,
  64.     bfd_target_coff_flavour_enum,
  65.     bfd_target_ieee_flavour_enum,
  66.     bfd_target_oasys_flavour_enum,
  67.     bfd_target_srec_flavour_enum} flavour;
  68.  
  69. /*
  70. The order of bytes within the data area of a file.
  71. */
  72.  
  73.   boolean byteorder_big_p;
  74.  
  75. /*
  76. The order of bytes within the header parts of a file.
  77. */
  78.  
  79.   boolean header_byteorder_big_p;
  80.  
  81. /*
  82. This is a mask of all the flags which an executable may have set -
  83. from the set @code{NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}.
  84. */
  85.  
  86.   flagword object_flags;       
  87.  
  88. /*
  89. This is a mask of all the flags which a section may have set - from
  90. the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}.
  91. */
  92.  
  93.   flagword section_flags;
  94.  
  95. /*
  96. The pad character for filenames within an archive header.
  97. */
  98.  
  99.   char ar_pad_char;            
  100.  
  101. /*
  102. The maximum number of characters in an archive header.
  103. */
  104.  
  105.  unsigned short ar_max_namelen;
  106.  
  107. /*
  108. The minimum alignment restriction for any section.
  109. */
  110.  
  111.   unsigned int align_power_min;
  112.  
  113. /*
  114. Entries for byte swapping for data. These are different to the other
  115. entry points, since they don't take BFD as first arg.  Certain other handlers
  116. could do the same.
  117. */
  118.  
  119.   SDEF (bfd_vma,      bfd_getx64, (bfd_byte *));
  120.   SDEF (void,         bfd_putx64, (bfd_vma, bfd_byte *));
  121.   SDEF (bfd_vma, bfd_getx32, (bfd_byte *));
  122.   SDEF (void,         bfd_putx32, (bfd_vma, bfd_byte *));
  123.   SDEF (bfd_vma, bfd_getx16, (bfd_byte *));
  124.   SDEF (void,         bfd_putx16, (bfd_vma, bfd_byte *));
  125.  
  126. /*
  127. Byte swapping for the headers
  128. */
  129.  
  130.   SDEF (bfd_vma,   bfd_h_getx64, (bfd_byte *));
  131.   SDEF (void,          bfd_h_putx64, (bfd_vma, bfd_byte *));
  132.   SDEF (bfd_vma,  bfd_h_getx32, (bfd_byte *));
  133.   SDEF (void,          bfd_h_putx32, (bfd_vma, bfd_byte *));
  134.   SDEF (bfd_vma,  bfd_h_getx16, (bfd_byte *));
  135.   SDEF (void,          bfd_h_putx16, (bfd_vma, bfd_byte *));
  136.  
  137. /*
  138. Format dependent routines, these turn into vectors of entry points
  139. within the target vector structure; one for each format to check.
  140.  
  141. Check the format of a file being read.  Return bfd_target * or zero. 
  142. */
  143.  
  144.   SDEF_FMT (struct bfd_target *, _bfd_check_format, (bfd *));
  145.  
  146. /*
  147. Set the format of a file being written.  
  148. */
  149.  
  150.   SDEF_FMT (boolean,            _bfd_set_format, (bfd *));
  151.  
  152. /*
  153. Write cached information into a file being written, at bfd_close. 
  154. */
  155.  
  156.   SDEF_FMT (boolean,            _bfd_write_contents, (bfd *));
  157.  
  158. /*
  159. The following functions are defined in @code{JUMP_TABLE}. The idea is
  160. that the back end writer of @code{foo} names all the routines
  161. @code{foo_}@var{entry_point}, @code{JUMP_TABLE} will built the entries
  162. in this structure in the right order.
  163.  
  164. Core file entry points
  165. */
  166.  
  167.   SDEF (char *, _core_file_failing_command, (bfd *));
  168.   SDEF (int,    _core_file_failing_signal, (bfd *));
  169.   SDEF (boolean, _core_file_matches_executable_p, (bfd *, bfd *));
  170.  
  171. /*
  172. Archive entry points
  173. */
  174.  
  175.  SDEF (boolean, _bfd_slurp_armap, (bfd *));
  176.  SDEF (boolean, _bfd_slurp_extended_name_table, (bfd *));
  177.  SDEF (void,   _bfd_truncate_arname, (bfd *, CONST char *, char *));
  178.  SDEF (boolean, write_armap, (bfd *arch, 
  179.                               unsigned int elength,
  180.                               struct orl *map,
  181.                               int orl_count, 
  182.                               int stridx));
  183.  
  184. /*
  185. Standard stuff.
  186. */
  187.  
  188.   SDEF (boolean, _close_and_cleanup, (bfd *));
  189.   SDEF (boolean, _bfd_set_section_contents, (bfd *, sec_ptr, PTR,
  190.                                             file_ptr, bfd_size_type));
  191.   SDEF (boolean, _bfd_get_section_contents, (bfd *, sec_ptr, PTR, 
  192.                                             file_ptr, bfd_size_type));
  193.   SDEF (boolean, _new_section_hook, (bfd *, sec_ptr));
  194.  
  195. /*
  196. Symbols and reloctions
  197. */
  198.  
  199.  SDEF (unsigned int, _get_symtab_upper_bound, (bfd *));
  200.   SDEF (unsigned int, _bfd_canonicalize_symtab,
  201.            (bfd *, struct symbol_cache_entry **));
  202.   SDEF (unsigned int, _get_reloc_upper_bound, (bfd *, sec_ptr));
  203.   SDEF (unsigned int, _bfd_canonicalize_reloc, (bfd *, sec_ptr, arelent **,
  204.                                                struct symbol_cache_entry**));
  205.   SDEF (struct symbol_cache_entry  *, _bfd_make_empty_symbol, (bfd *));
  206.   SDEF (void,     _bfd_print_symbol, (bfd *, PTR, struct symbol_cache_entry  *,
  207.                                       bfd_print_symbol_enum_type));
  208. #define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
  209.   SDEF (alent *,   _get_lineno, (bfd *, struct symbol_cache_entry  *));
  210.  
  211.   SDEF (boolean,   _bfd_set_arch_mach, (bfd *, enum bfd_architecture,
  212.                                        unsigned long));
  213.  
  214.   SDEF (bfd *,  openr_next_archived_file, (bfd *arch, bfd *prev));
  215.   SDEF (boolean, _bfd_find_nearest_line,
  216.         (bfd *abfd, struct sec  *section,
  217.          struct symbol_cache_entry  **symbols,bfd_vma offset,
  218.         CONST char **file, CONST char **func, unsigned int *line));
  219.   SDEF (int,    _bfd_stat_arch_elt, (bfd *, struct stat *));
  220.  
  221.   SDEF (int,    _bfd_sizeof_headers, (bfd *, boolean));
  222.  
  223.   SDEF (void, _bfd_debug_info_start, (bfd *));
  224.   SDEF (void, _bfd_debug_info_end, (bfd *));
  225.   SDEF (void, _bfd_debug_info_accumulate, (bfd *, struct sec  *));
  226.  
  227. /*
  228. Special entry points for gdb to swap in coff symbol table parts
  229. */
  230.  
  231.   SDEF(void, _bfd_coff_swap_aux_in,(
  232.        bfd            *abfd ,
  233.        PTR             ext,
  234.        int             type,
  235.        int             class ,
  236.        PTR             in));
  237.  
  238.   SDEF(void, _bfd_coff_swap_sym_in,(
  239.        bfd            *abfd ,
  240.        PTR             ext,
  241.        PTR             in));
  242.  
  243.   SDEF(void, _bfd_coff_swap_lineno_in,  (
  244.        bfd            *abfd,
  245.        PTR            ext,
  246.        PTR             in));
  247.  
  248. } bfd_target;
  249.  
  250. /*
  251.  
  252. *i bfd_find_target
  253. Returns a pointer to the transfer vector for the object target
  254. named target_name.  If target_name is NULL, chooses the one in the
  255. environment variable GNUTARGET; if that is null or not defined then
  256. the first entry in the target list is chosen.  Passing in the
  257. string "default" or setting the environment variable to "default"
  258. will cause the first entry in the target list to be returned,
  259. and "target_defaulted" will be set in the BFD.  This causes
  260. @code{bfd_check_format} to loop over all the targets to find the one
  261. that matches the file being read.  
  262. */
  263.  PROTO(bfd_target *, bfd_find_target,(CONST char *, bfd *));
  264.  
  265. /*
  266.  
  267. *i bfd_target_list
  268. This function returns a freshly malloced NULL-terminated vector of the
  269. names of all the valid BFD targets. Do not modify the names 
  270. */
  271.  PROTO(CONST char **,bfd_target_list,());
  272.  
  273. /*
  274. */
  275.  
  276.